package com.projectnection.server.database.liveFeed;

import java.util.Date;

import com.googlecode.objectify.Key;
import com.googlecode.objectify.Objectify;
import com.projectnection.server.database.ObjectifyServiceCreation;
import com.projectnection.server.model.Entity;
import com.projectnection.server.model.LiveFeed;

public class SaveLiveFeed {

	public static LiveFeed loadLiveFeed(String entityIDFrom, String entityIDTo,
			String feedDescription) {

		LiveFeed liveFeed = new LiveFeed();

		liveFeed.setLiveFeedDate(new Date());
		liveFeed.setLiveFeedDescription(feedDescription);

		liveFeed.setEntityIDFrom(new Key<Entity>(Entity.class, entityIDFrom));

		liveFeed.setEntityIDTo(new Key<Entity>(Entity.class, entityIDTo));

		return liveFeed;
	}

	public static LiveFeed addNew(LiveFeed liveFeed) {

		Objectify objfyService = ObjectifyServiceCreation.gerService();

		objfyService.put(liveFeed);

		return liveFeed;
	}
}